package net.sx.minemodule.mvp.presenters;

import com.kedll.library.mvp.AbstractRefreshPresenter;
import com.kedll.library.mvp.RefreshingView;

import net.sx.minemodule.mvp.bean.RecordInfoModel;

import io.reactivex.Observable;

/**
 * add shibo.zheng
 * 19/06/17
 * 记录详情presenter
 */

public class MineRecordInfoPresenter extends AbstractRefreshPresenter {
    private String recordInfoType;

    public MineRecordInfoPresenter(RefreshingView mView) {
        super(mView);
    }

    @Override
    protected void fetchData(boolean isLoadMore) {
        addSubscription(Observable.range(0, 10)
        .map(integer -> getRecordInfoData())
        .toList()
        .subscribe(recordInfoModels -> parserData(isLoadMore, recordInfoModels)));
    }

    /**
     * 设置当前界面的type，根据teyp区分界面
     * @param type
     */
    public void setRecordInfoType(String type) {
        this.recordInfoType = type;
    }

    /**
     * 通过此方法给积分/佣金/奖牌等界面展示详情数据
     * @return
     */
    private RecordInfoModel getRecordInfoData() {
        RecordInfoModel recordInfo = new RecordInfoModel();
        recordInfo.setRecordInfoDate("2019-06-17");
        recordInfo.setRecordInfoTime("11:19");
        recordInfo.setRecordInfoText("累计获得积分:");
        recordInfo.setRecordInfoNum("22(个)");
        return recordInfo;
    }
}
